﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A88判断数组中是否存在重复元素
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] array = { 2, 3, 2, 6, 7 };
            bool b=  HasSameElement(array);
            Console.WriteLine(b);
        }

        //
        static bool HasSameElement(int[] array) 
        {
            for (int i = 0; i < array.Length-1; i++) //i是比较数的索引
            {
                for (int j = i+1; j < array.Length; j++) //j是被比较数索引
                {
                    if (array[i]==array[j]) 
                    {
                        return true;
                    }
                }
            }
            return false;
        }
    }
}
